import os
import shutil


def move_images(src_dir, dst_dir, form):
    if not os.path.exists(dst_dir):
        os.makedirs(dst_dir)
    for root, dirs, files in os.walk(src_dir):
        for file in files:
            if file.endswith(form) or file.endswith('.json'):
                src_file = os.path.join(root, file)
                dst_file = os.path.join(dst_dir, file)

                shutil.copy2(src_file, dst_file)

                print(f"cp {src_file} to {dst_file}")


source_dir = r'/media/share-rw/GOODWE-POC/MI-DIP/shaixuan/konghangNG'
image_form = '.bmp'

data_name_string = "test"
target_dir = f'/home/jacy/GDW/data_{data_name_string}/labelme'

move_images(source_dir, target_dir, image_form)
